﻿<?xml version="1.0" encoding="utf-8" ?>
<DbDataRequest connection="$UserLoginDBConnection$" type="$UserLoginDbType$" defaultFormatter="bizobj Company">
  <SqlStatement hasResults="true">
		SELECT  t.objectId as id,t.parentId,t.parentHostId,c.name,tc.keyName,tc.depth,
		c.anonymousId,c.canCreateChildCompanies,c.enable,c.autoCreateCompany, c.shortName,
		c.autoCreateUser
		FROM ObjectTreeNodes  t 
			INNER JOIN ObjectTreeCounts as tc on tc.objectId = t.objectId
			INNER JOIN Companies c ON c.id=t.objectId
		WHERE t.parentId=@parentId
		ORDER BY tc.keyName
	</SqlStatement>
  <Param name="parentId" type="UniqueIdentifier"/>
</DbDataRequest>